//
//  Order.m
//  命令模式
//
//  Created by flannery on 2018/12/19.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "Order.h"

@implementation Order
- (void)execute{}
@end

@interface BuyStock ()
@property (nonatomic, strong) Stock * abcStock;
@end
@implementation BuyStock
- (instancetype)initWithStock:(Stock *)abcStock{
    if(self = [super init]) {
        self.abcStock = abcStock;
    }
    return self;
}
- (void)execute{
    if(self.abcStock) {
        [self.abcStock buy];
    }
}
@end


@interface SellStock ()
@property (nonatomic, strong) Stock * abcStock;
@end
@implementation SellStock
- (instancetype)initWithStock:(Stock *)abcStock{
    if(self = [super init]) {
        self.abcStock = abcStock;
    }
    return self;
}
- (void)execute{
    if(self.abcStock) {
        [self.abcStock sell];
    }
}
@end
